#MACH=arduino:avr:uno
#CPU=atmega328p
#PORT=/dev/ttyACM0
#BAUD=115200

#MACH=arduino:avr:uno
#CPU=atmega328p
#PORT=/dev/ttyUSB0
#BAUD=57600

MACH=arduino:avr:nano:cpu=atmega328
PORT=/dev/ttyUSB0
BAUD=57600
CPU=atmega328p

HARD=/usr/share/arduino/hardware
TOOLS=/usr/share/arduino/tools

BASE=$(shell pwd)
SRC=arduino-kiss.ino
BUILDP=$(BASE)/.build
OBJ=.build/$(SRC).hex

all:
	rm -rf .build; mkdir .build 
	arduino-builder -hardware $(HARD) -tools $(TOOLS) -fqbn $(MACH) -build-path $(BUILDP) -compile $(SRC)

upload:
	avrdude -V -F -C /etc/avrdude.conf -p $(CPU) -P $(PORT) -c arduino -b $(BAUD) -U flash:w:$(OBJ)

